package org.zhao.nettydemos.lab05;

import java.util.concurrent.*;

/**
 * @Auther: xiaohui.zhao
 * @Date: 2021/9/17 15:29
 * @Description:
 */
public class FutureTaskTest01 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newSingleThreadExecutor();
        FutureTask<String> futureTask = new FutureTask<>(new Callable<String>() {
            @Override
            public String call() throws Exception {
                return "获取FutureTask获取异步结果 线程池版";
            }
        });

        executorService.submit(futureTask);
        System.out.println(futureTask.get());
        executorService.shutdown();
    }

}